The event queue is a standard Macintosh Operating System queue that the Operating System Event Manager maintains. Only mouse-up, mouse-down, key-up, key-down, auto-key, and disk-inserted events are stored in the Operating System event queue. In most cases, your application should not access the event queue directly. Instead you usually use the WaitNextEvent function (WaitNextEvent) , which can retrieve events from this queue as well as from other sources.
The event queue consists of a header followed by the actual entries in the queue. The event queue has the same header as all standard Macintosh Operating System queues. The Qhdr structure defines the queue header.
struct QHdr { /* queue header */
short qFlags; /* queue flags */
QElemPtr qHead; /* first queue entry */
QElemPtr qTail; /* last queue entry */
};
A structure of type EvQEl defines an entry in the Operating System event queue.
struct EvQEl { /* Operating System event queue */
QElemPtr qLink; /* next queue entry */
short qType; /* queue type (evType) */
EventKind evtQWhat; /* event code */
UInt32 evtQMessage; /* event message */
UInt32 evtQWhen; /* ticks since startup */
Point evtQWhere; /* mouse location */
EventModifiers evtQModifiers; /* modifier flags */
};
typedef struct EvQEl EvQEl;
typedef EvQEl *EvQElPtr;
Each entry in the event queue begins with 4 bytes of flags followed by a pointer to the next queue entry. The flags are maintained by and internal to the Operating System Event Manager. The queue entries are linked by pointers, and the first field of the EvQEl data type, which represents the structure of a queue entry, begins with a pointer to the next queue entry. Thus, you cannot directly access the flags using the EvQEl data type.